import {defineStore} from 'pinia'
import type{IAddress} from '@/types/index'

export const useAddressStore = defineStore('address',{
    state(){
        return{
            addresslist:[] as Array<IAddress>,
        }
    },
    actions:{
        saveaddress(adderss:IAddress){
            // 储存地址
            this.addresslist.push(adderss)
        }
    },

    persist: {
        enabled: true,
        strategies: [
            {
                key: 'address',
                storage: sessionStorage,
                paths: ['addresslist'],
            },
        ],
    },
})